#include<stdio.h>
int main()
{
    long long a,b;
    long long c;
    while(~scanf("%lld%lld",&a,&b))
    {
        while(1)
    {
        c = a%b;
        if(c == 0)
        {
            break;
        }
        a = b;
        b = c;
    }
    printf("%lld\n",b);
    }
    return 0;
}